﻿<views:WindowBase x:Class="PortUtil.Views.SettingsWindow"
                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                  xmlns:services="clr-namespace:PortUtil.Services;assembly=PortUtil.Services"
                  xmlns:converters="clr-namespace:PortUtil.Converters"
                  xmlns:views="clr-namespace:PortUtil.Views"
                  xmlns:system="clr-namespace:System;assembly=mscorlib"
                  xmlns:behaviors="clr-namespace:PortUtil.Behaviors"
                  xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                  xmlns:portUtil="clr-namespace:PortUtil"
                  portUtil:WindowEx.ShowIcon="false"
                  Title="Options" Height="330" Width="457" ResizeMode="NoResize" ShowInTaskbar="False"
                  WindowStartupLocation="CenterOwner" Closing="WindowBase_Closing">
    <views:WindowBase.Resources>

    </views:WindowBase.Resources>
    <views:WindowBase.DataContext>
        <Binding Mode="OneWay" Path="SettingsViewModel" Source="{StaticResource Locator}" />
    </views:WindowBase.DataContext>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="45" />
        </Grid.RowDefinitions>

        <Button x:Name="OkButton" Command="{Binding OkCommand}" Content="Ok" IsDefault="True"
                HorizontalAlignment="Right" Margin="0,0,99,10" VerticalAlignment="Bottom" Width="75" Grid.Row="1"
                Height="20" Click="OkButton_Click" IsEnabled="{Binding IsValid, Mode=OneWay}" />
        <Button x:Name="CancelButton" Command="{Binding CancelCommand}" Content="Cancel" IsCancel="True"
                HorizontalAlignment="Right" Margin="0,0,10,10" VerticalAlignment="Bottom" Width="75" Grid.Row="1"
                Height="20" Click="CancelButton_Click" />


        <TabControl Grid.Row="0" Margin="5">
            <TabItem Header="Console">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30" />
                        <RowDefinition Height="40" />
                        <RowDefinition Height="40" />
                        <RowDefinition Height="25" />
                        <RowDefinition Height="40" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="120" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <ComboBox Grid.Column="1" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"
                              Width="120" Height="22" Grid.Row="1" ItemsSource="{Binding ColorList}"
                              SelectedItem="{Binding ForegroundColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                    <Label Content="Foreground" HorizontalAlignment="Right" Margin="0,8,0,0" VerticalAlignment="Top"
                           RenderTransformOrigin="0.553,0.192" HorizontalContentAlignment="Right" Height="26"
                           Width="103" Grid.Row="1" />
                    <ComboBox Grid.Column="1" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"
                              Width="120" Height="22" Grid.Row="2" ItemsSource="{Binding ColorList}"
                              SelectedItem="{Binding BackgroundColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                    <Label Content="Background" HorizontalAlignment="Right" Margin="0,8,0,0" VerticalAlignment="Top"
                           HorizontalContentAlignment="Right" Height="26"
                           Width="103" Grid.Row="2" />
                    <ComboBox Grid.Column="1" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"
                              Width="150" Height="22" Grid.Row="4" ItemsSource="{Binding FontFamilyList}"
                              SelectedItem="{Binding FontFamily, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                    <Label Content="Font" HorizontalAlignment="Right" Margin="0,8,0,0" VerticalAlignment="Top"
                           HorizontalContentAlignment="Right" Height="26"
                           Width="103" Grid.Row="4" />
                    <AdornerDecorator Grid.Column="1" HorizontalAlignment="Left" Margin="208,10,0,0"
                                      VerticalAlignment="Top"
                                      Width="60" Height="22" Grid.Row="4">
                        <ComboBox IsEditable="True"
                                  Text="{Binding FontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True, ValidatesOnDataErrors=True}">

                            <i:Interaction.Behaviors>
                                <behaviors:TextBoxInputRegExBehaviour RegularExpression="^[0-9.\-]+$" EmptyValue="0"
                                                                      MaxLength="3" />
                            </i:Interaction.Behaviors>

                            <system:Int32>8</system:Int32>
                            <system:Int32>9</system:Int32>
                            <system:Int32>10</system:Int32>
                            <system:Int32>12</system:Int32>
                            <system:Int32>14</system:Int32>
                            <system:Int32>16</system:Int32>
                            <system:Int32>18</system:Int32>
                            <system:Int32>20</system:Int32>
                            <system:Int32>22</system:Int32>
                            <system:Int32>24</system:Int32>
                            <system:Int32>28</system:Int32>
                            <system:Int32>36</system:Int32>
                        </ComboBox>
                    </AdornerDecorator>
                    <Label Content="Size" Grid.Column="1" HorizontalAlignment="Left" Margin="172,8,0,0" Grid.Row="4"
                           VerticalAlignment="Top" HorizontalContentAlignment="Right" />
                </Grid>
            </TabItem>
        </TabControl>
        <Button Content="Apply" HorizontalAlignment="Left" Margin="10,0,0,10" Grid.Row="1" VerticalAlignment="Bottom"
                Width="75" Command="{Binding ApplyCommand}" IsEnabled="{Binding IsValid, Mode=OneWay}" />
    </Grid>
</views:WindowBase>